package com.flyme.module.base.provider.service.impl;

import com.flyme.core.base.supper.service.impl.BaseServiceImpl;
import com.flyme.module.base.client.entity.SysConditionitem;
import com.flyme.module.base.provider.mapper.SysConditionitemMapper;
import com.flyme.module.base.provider.service.SysConditionitemService;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

@Service
public class SysConditionitemServiceImpl extends BaseServiceImpl<SysConditionitemMapper, SysConditionitem> implements SysConditionitemService {


    @Override
    public Map<Long, String> selectItems() {
        List<SysConditionitem> list = list();
        return list.stream().collect(Collectors.toMap(SysConditionitem::getId,SysConditionitem::getConditionName));
    }

    @Override
    public SysConditionitem getConditionitem(Integer conditionType, String sortOrder){
        return getOne(q().eq("conditionType", conditionType).eq("sortOrder", sortOrder), false);
    }
}
